package SocialSharing
{
	public class SocialMedia
	{
		import flash.net.navigateToURL;
		import flash.net.URLVariables;
		import flash.net.URLRequest;
		import flash.net.URLRequestMethod;
		
		public function SocialMedia()
		{
		}
		
		
		function shareClickHandler(evt:MouseEvent):void
		{
			var varsShare:URLVariables = new URLVariables();
			varsShare.u = 'http://apps.netgfx.com/index.html';
			varsShare.t = 'apps.netgfx.com';
			
			var urlFacebookShare:URLRequest = new URLRequest('http://www.facebook.com/sharer.php');
			urlFacebookShare.data = varsShare;
			urlFacebookShare.method = URLRequestMethod.GET;
			
			navigateToURL(urlFacebookShare, '_blank');
		}
		
		
		public function shareFacebook(evt:Event = null):void {
			if(ExternalInterface.available) {
				var code:XML = <script>
				  <![CDATA[
					function shareFacebook(){
					  var d=document
					  var f='http://www.facebook.com/share'
					  var l=http://apps.netgfx.com
					  var e=encodeURIComponent
					  var t="apps.netgfx.com"
					  var p='.php?src=bm&v=4&i=1277427231&u='+e(l.href)+'&t='+e(t);
					  try{if(!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z) {a=function() {if (!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=1,width=626,height=436'))l.href=f+p};if (/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0);
					}
				  ]]>
				</script>;
				ExternalInterface.call(code);
			}
		}

	}
}